import logging

import redis

ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif', 'mp4', "zip"}
UPLOAD_FOLDER = '/home/shuaigan/PycharmProjects/Text/source_video'


class Config(object):
    DEBUG = False
    # 直接运行 提示warning里面抄过来
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1/info'
    # 取消自动追踪
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    """
    import os,base64
    base64.b64encode(os.urandom(24))
    """

    SECRET_KEY = "rmCbO4LaVAQaP6DC61Yldt9awusQJAEz"
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379
    SESSION_TYPE = "redis"
    # 让cookie中的session_id被加密签名处理
    SESSION_USE_SIGNER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    # app默认配置31天
    PERMANENT_SESSION_LIFE_TIME = 86400  # 有效期


class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = 'mysql://shuaigan:mysql@127.0.0.1/info'
    LOG_LEVEL = logging.WARNING
    DEBUG = False


class DevelopmentConfig(Config):
    LOG_LEVEL = logging.DEBUG
    DEBUG = 1
    host = "0.0.0.0"
    port = "5000"


class TestingConfig(Config):
    TESTING = True
